package com.zengruoxing.helloworld;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.EditText;
import android.content.Intent;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void onClick(View view) {
//        Toast.makeText(this, "响应按钮事件",
//                Toast.LENGTH_LONG).show();
        TextView input = (TextView) findViewById(R.id.textView_title);
        String string = input.getText().toString() + " changed by xxx";
        //Toast.makeText(this, string, Toast.LENGTH_LONG).show();

        EditText input1 = (EditText) findViewById(R.id.editText_account);
        String str = input1.getText().toString();
        input.setText(str);
        String account, password;
        account = str;
        EditText inputp = (EditText) findViewById(R.id.editText_pwd);
        password = inputp.getText().toString();
        Log.d("a", password);
        Log.d("a", account);
        if (account.equals("admin") && password.equals("123456")) {
            Log.d("a", "message");
            Toast.makeText(this, "accept", Toast.LENGTH_LONG).show();
            Intent intent1 = new Intent();
            intent1.setClass(MainActivity.this, NextActivity.class);
            startActivity(intent1);
        }
    }
}